// 社保差额账单
import expandRow from './table-expand.vue'
export const ShouldPayableThead = [
  {
    title: '费用月份',
    key: 'feeDate',
    width: 100,
    render: (h, params) => {
      const month = params.row.periodMonth < 10 ? '0' + params.row.periodMonth : params.row.periodMonth
      const text = params.row.periodYear + '' + month
      return h('span', text)
    }
  },
  {
    title: '社保编号',
    key: 'insureNo'
  },
  {
    title: '养老差额',
    key: 'pension',
    render: (h, params) => {
      // const text = params.row.Pensionshould + ' (' + params.row.Pensionbalance + ')'
      // return h('span', text)
      var should = params.row.Pensionshould || 0
      var balance = params.row.Pensionbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '医疗差额',
    key: 'medicalCare',
    render: (h, params) => {
      // const text = params.row.MedicalCareshould + ' (' + params.row.MedicalCarebalance + ')'
      // return h('span', text)
      var should = params.row.MedicalCareshould || 0
      var balance = params.row.MedicalCarebalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '失业差额',
    key: 'unemployment',
    render: (h, params) => {
      // const text = params.row.Unemploymentshould + ' (' + params.row.Unemploymentshould + ')'
      // return h('span', text)
      var should = params.row.Unemploymentshould || 0
      var balance = params.row.Unemploymentbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '工伤差额',
    key: 'injuryOnTheJob',
    render: (h, params) => {
      // const text = params.row.InjuryOnTheJobshould + ' (' + params.row.InjuryOnTheJobbalance + ')'
      // return h('span', text)
      var should = params.row.InjuryOnTheJobshould || 0
      var balance = params.row.InjuryOnTheJobbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '生育差额',
    key: 'birth',
    render: (h, params) => {
      // const text = params.row.Birthshould + ' (' + params.row.Birthbalance + ')'
      // return h('span', text)
      var should = params.row.Birthshould || 0
      var balance = params.row.Birthbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '大病差额',
    key: 'seriousIllness',
    render: (h, params) => {
      // const text = params.row.SeriousIllnessshould + ' (' + params.row.SeriousIllnessbalance + ')'
      // return h('span', text)
      var should = params.row.SeriousIllnessshould || 0
      var balance = params.row.SeriousIllnessbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '残保金差额',
    key: 'disabledPersonsSecurityFund',
    render: (h, params) => {
      var should = params.row.DisabledPersonsSecurityFundshould || 0
      var balance = params.row.DisabledPersonsSecurityFundbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '门诊医疗差额',
    key: 'outpatientDepartment',
    render: (h, params) => {
      var should = params.row.OutpatientDepartmentshould || 0
      var balance = params.row.OutpatientDepartmentbalance || 0
      // const text = should + ' (' + balance + ')'
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '差额总计',
    key: 'total',
    render: (h, params) => {
      const text = params.row.totalShould + ' (' + params.row.totalBalance + ')'
      return h('span', text)
    }
  },
  {
    title: '展开',
    type: 'expand',
    key: 'expand',
    // slot: 'action',
    fixed: 'right',
    width: 70,
    render: (h, params) => {
      return h(expandRow, {
        props: {
          row: params.row
        }
      })
    }
  }
]

// 展开表格
export const ShouldPayableChildrenThead = [
  {
    title: '费用月份',
    key: 'feeDate',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      const month = params.row.periodMonth < 10 ? '0' + params.row.periodMonth : params.row.periodMonth
      const text = params.row.periodYear + '' + month
      return h('span', text)
    }
  },
  {
    title: '社保编号',
    key: 'insureNo',
    minWidth: 150,
    tooltip: true
  },
  {
    title: '客户名称',
    key: 'companyName',
    minWidth: 150,
    tooltip: true
  },
  {
    title: '客户编码',
    key: 'companyCode',
    minWidth: 150,
    tooltip: true
  },
  {
    title: '养老差额',
    key: 'Pension',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.Pensionshould || 0
      var balance = params.row.Pensionbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '医疗差额',
    key: 'medicalCare',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.MedicalCareshould || 0
      var balance = params.row.MedicalCarebalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '失业差额',
    key: 'unemployment',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.Unemploymentshould || 0
      var balance = params.row.Unemploymentbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '工伤差额',
    key: 'injuryOnTheJob',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.InjuryOnTheJobshould || 0
      var balance = params.row.InjuryOnTheJobbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '生育差额',
    key: 'birth',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.Birthshould || 0
      var balance = params.row.Birthbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '大病差额',
    key: 'seriousIllness',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.SeriousIllnessshould || 0
      var balance = params.row.SeriousIllnessbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '残保金差额',
    key: 'disabledPersonsSecurityFund',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.DisabledPersonsSecurityFundshould || 0
      var balance = params.row.DisabledPersonsSecurityFundbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '门诊医疗差额',
    key: 'outpatientDepartment',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      var should = params.row.OutpatientDepartmentshould || 0
      var balance = params.row.OutpatientDepartmentbalance || 0
      const text = +balance !== 0 ? should + ' (' + balance + ')' : ''
      return h('span', text)
    }
  },
  {
    title: '差额总计',
    key: 'total',
    minWidth: 150,
    tooltip: true,
    render: (h, params) => {
      const text = params.row.totalShould + ' (' + params.row.totalBalance + ')'
      return h('span', text)
    }
  }
]
